<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<html>
<head>

<script language="VB" runat="server">

  Sub Page_Load(Source As Object, E As EventArgs)

    if not isPostBack

      Dim myConnection As SQLConnection
      Dim myCommand As SQLCommand
      Dim myReader  As SQLDataReader
      Dim SQL       As String
      Dim ConnStr   As String

      SQl = "select * from Shippers"
      ConnStr = "server=localhost;uid=sa;pwd=;database=Northwind"

      myConnection = New SQLConnection(ConnStr)
      myConnection.Open()

      myCommand = New SQLCommand(SQL, myConnection)

      myReader = myCommand.ExecuteReader()

      While myReader.Read()
        ShipMethod.Items.Add(New ListItem(myReader.Item("CompanyName"), _
                                  myReader.Item("ShipperID")))
      End While

    end if

  End Sub

  Sub PlaceOrder_click(Source As Object, E As EventArgs) 

    YouSelected.Text = "Your order will be delivered via " & _
                       ShipMethod.SelectedItem.Text

  End Sub

</script>

<form runat="server">

  Please select your delivery method:

  <asp:DropDownList id="ShipMethod"
       runat="server"/>

  <br/>

  <asp:button id="PlaceOrder" Text="Place Order"
       onclick="PlaceOrder_Click"
       runat="server"/>

  <br/>

  <asp:Label id="YouSelected" runat="server"/>
</form>
</html>
